package com.work.demo.test;

/**
 * 业务域错误码
 * 使用 1-001-000 段
 *
 * @author yedu
 */
public enum BizError implements BaseError {
    // ========== 驾驶舱 30000/40000 ==========
    LICENSE_EXPIRED(30000,"您的平台授权码已过期，请联系管理员"),
    COCKPIT_TOKEN_INVALID(40000, "驾驶舱token无效，请确认是否正确"),

    // ========== 流程域 1001000 ==========
    FLOW_VERSION_NOT_NEWEST(1001001, "流程不是最新版本,请刷新页面后重试"),
    FLOW_NOT_FOUND(1001002, "未找到流程"),
    FLOW_CREATE_ERROR(1001003, "流程创建失败"),
    FLOW_UPDATE_ERROR(1001004, "流程更新失败"),
    // flow job
    FLOW_JOB_NOT_FOUND(1001005, "作业未找到"),
    FLOW_JOB_CANNOT_RUN(1001006, "作业无法运行"),
    FLOW_JOB_RUN_FAILED(1001007, "作业运行失败"),
    FLOW_JOB_CONTINUE_FAILED(1001008, "作业继续运行失败"),
    FLOW_JOB_STOP_FAILED(1001009, "作业停止失败"),
    FLOW_JOB_CHECK_FAILED(1001010, "作业启动校验失败"),
    FLOW_JOB_CREATE_FAILED(1001011, "作业创建失败"),
    FLOW_JOB_START_FAILED(1001012, "作业启动失败"),
    FLOW_JOB_PARTNER_CREATE_FAILED(1001013, "合作方创建作业失败"),
    FLOW_JOB_PARTNER_START_FAILED(1001014, "合作方启动作业失败"),
    FLOW_JOB_PARTNER_STOP_FAILED(1001015, "合作方停止作业失败"),
    FLOW_JOB_EXIST(1001016, "job已存在"),
    // flow task
    FLOW_TASK_NOT_FOUND(1001031, "任务未找到"),
    FLOW_TASK_PARTNER_START_FAILED(1001032, "合作方节点task启动失败"),
    FLOW_TASK_PARTNER_STOP_FAILED(1001033, "合作方节点task停止失败"),
    FLOW_TASK_ARBITER_START_FAILED(1001034, "发起方arbiter启动失败"),
    FLOW_TASK_PARTNER_ARBITER_START_FAILED(1001035, "合作方arbiter启动失败"),
    FLOW_TASK_ARBITER_API_FAILED(1001036, "arbiter api请求错误"),
    FLOW_TASK_START_PARAMS_NOT_FOUND(1001037, "task启动参数未找到"),
    FLOW_TASK_START_FAILED(1001038, "任务启动失败"),
    // flow dag
    FLOW_DAG_NOT_FOUND(1001051, "找不到dag"),
    FLOW_DAG_NOT_FOUND_CMP_IN_CONFIG(1001052, "流程Config中找不到该组件"),
    FLOW_DAG_PARSE_ERROR(1001053, "dag解析异常"),
    // flow config
    FLOW_CONFIG_PARSE_ERROR(1001061, "config解析异常"),
    FLOW_CONFIG_SETTING_SAVE_FAILED(1001062, "setting保存失败"),
    // flow snapshot
    FLOW_SNAPSHOT_NOT_FOUND(1001071, "找不到该流程快照数据"),
    FLOW_SNAPSHOT_UPDATE_FAILED(1001072, "更新快照数据失败"),
    // mpc
    FLOW_MPC_OPERATOR_LIBRARY_OPERATE_ERROR(1001081, "mpc算子库操作失败"),
    FLOW_MPC_COMMON_ERROR(1001082, "MPC ERROR"),
    // flow-import
    FLOW_IMPORT_ERROR(1001092, "流程导入失败"),

    // ========== 节点域 1002000 ==========
    NODE_PARAM_ERROR(1002000, "参数错误"),
    NODE_INVITE_SELF(1002001, "您无法申请自己节点成为合作伙伴！"),
    NODE_INVITE_PARTNER(1002002, "已是合作伙伴, 请勿重复邀请"),
    NODE_INVITE_REPEAT(1002003, "已邀请好友, 请勿重复邀请"),
    NODE_NOT_INIT(1002004, "邀请节点还未初始化"),
    NODE_COMMUNICATION_ERROR(1002005, "通讯异常"),
    NODE_ID_ERROR(1002006, "节点ID异常"),
    NODE_PROCESS_ILLEGAL(1002007, "操作不合法"),
    ADDRESS_CHANGE(1002008, "节点地址异常"),
    CONTRACT_STATUS_DIFFERENT(1002009, "两边合约状态不一致"),
    NODE_CONTRACT_CONFIRM(1002010, "请进行合约审核操作"),
    CONTRACT_ID_INVALID(1002011, "无效的contract_id"),
    NODE_ADDRESS_DUPLICATE(1002012, "不同节点ID，节点地址重复，请联系管理员"),
    NODE_CREDENTIAL_ERROR(1002013, "生成证书失败"),

    //  ========== 项目域 1003000 ==========
    PROJECT_ERROR(1003000, "项目内部发生异常"),
    PROJECT_NAME_REPEAT(1003001, "项目名称重复"),
    PROJECT_NOT_FOUND(1003002, "项目不存在"),
    PROJECT_PARAM_ERROR(1003003, "参数不正确"),
    PROJECT_PROCESS_ILLEGAL(1003004, "操作不合法"),

    //  ========== 数据域 1004000 ==========
    DATA_ERROR(1004000, "数据异常"),
    DATA_STORAGE_ERROR(1004001, "数据存储异常"),
    DATA_STORAGE_OSS_ERROR(1004002, "未获取到数据库中配置的OSS存储信息"),

    // 数据集异常
    DATA_DATASET_ERROR(1004100, "样本集异常"),
    DATA_DATASET_NAME_REPEAT(1004101, "样本集名称重复"),
    DATA_DATASET_NOT_FOUND(1004102, "样本集不存在"),
    DATA_DATASET_ARGUMENT_NOT_VALID(1004103, "样本集参数校验不通过"),
    DATA_DATASET_SCOPE_ERROR(1004104, "样本集使用范围异常"),
    DATA_DATASET_USER_AUTH_ERROR(1004105, "样本集权限校验不通过"),
    DATA_DATASET_PRETREATMENT_ERROR(1004106, "数据预处理异常"),
    DATA_DATASET_UPLOAD_ERROR(1004200, "样本集上传异常"),
    DATA_DATASET_UPLOAD_PARAM_ERROR(1004201, "请先选择一个对象存储账号!"),
    DATA_DATASET_UPLOAD_PARAM_VALIDATE_ERROR(1004202, "请先选择一个对象存储账号!"),
    DATA_DATASET_AUTH_ERROR(1004300, "样本集授权异常"),
    DATA_DATASET_AUTH_CONFLICT(1004301, "样本集授权冲突"),
    DATA_DATASET_AUTH_SCOPE_NOT_SUPPORT(1004302, "样本集授权作用域不支持"),
    DATA_DATASET_AUTH_ARGUMENT_NOT_VALID(1004303, "样本集授权参数校验不通过"),
    DATA_DATASET_AUTH_APPLY_ERROR(1004304, "样本集授权申请失败"),
    DATA_DATASET_AUTH_CONFIRM_ERROR(1004305, "样本集审批处理失败"),
    DATA_DATASET_AUTH_REVOKE_ERROR(1004306, "样本集解约异常"),
    DATA_DATASET_AUTH_CANCEL_ERROR(1004307, "样本集申请撤销异常"),
    DATA_DATASET_AUTH_PERM_STATUS_ERROR(1004308, "样本集授权状态异常"),
    DATA_DATASET_AUTH_NOT_FOUND(1004309, "样本集授权信息不存在"),
    DATA_DATASET_SYNCHRONIZATION_FAILED(1004310, "样本集同步失败"),
    // 数据资源异常
    DATA_DATASOURCE_ERROR(1004500, "数据资源异常"),
    DATA_DATASOURCE_NOT_FOUND(1004501, "数据资源不存在"),
    DATA_DATASOURCE_ARGUMENT_NOT_VALID(1004502, "数据资源参数校验不通过"),
    DATA_DATASOURCE_STORAGE_ERROR(1004503, "当前文件状态不可编辑"),
    // 数据源库异常
    DATA_DATABASE_ERROR(1004600, "数据库异常"),
    DATA_DATABASE_NOT_FOUND(1004601, "数据库信息不存在"),
    // 数据源异常
    DATA_CONN_ERROR(1004700, "数据源异常"),
    DATA_CONN_NOT_SUPPORT(1004701, "不支持的数据源"),
    DATA_CONN_JDBC_ERROR(1004702, "数据源JDBC连接异常"),
    DATA_CONN_S3_ERROR(1004703, "数据源S3异常"),
    DATA_CONN_HBASE_ERROR(1004704, "数据源HBASE异常"),
    DATA_CONN_HTTP_ERROR(1004705, "数据源HTTP异常"),
    DATA_CONN_HDFS_ERROR(1004706, "数据源HDFS异常"),
    DATA_CONN_ES_ERROR(1004707, "数据源ES异常"),
    // 异构模型
    ISO_MODEL_ERROR(1004800, "异构模型"),
    ISO_MODEL_S3_DOWN_ERROR(1004801, "异构模型-下载模型文件失败"),
    ISO_MODEL_S3_UPLOAD_ERROR(1004802, "异构模型-上传模型文件失败"),
    ISO_MODEL_ZIP_ERROR(1004803, "异构模型-创建压缩文件失败"),

    MODEL_DETAIL_ERROR(1004920,"获取模型详情异常"),

    // ========== 注册中心 1005000 ==========
    REG_ADDRESS_NOT_FOUND(1005001, "未找到组件注册地址"),
    REG_CMP_REGISTER_ERROR(1005002, "组件注册失败"),
    REG_CMP_HEARTBEAT_ERROR(1005003, "组件心跳出错"),

    // ========== 组件域 1006000 ==========
    CMP_NOT_FOUND(1006001, "未找到组件"),
    CMP_SERVER_INVALID(1006002, "组件服务不可用"),
    CMP_LOADER_ERROR(1006003, "加载器组件异常"),
    CMP_TRANSFER_ERROR(1006004, "组件请求转发异常"),

    // ========== 系统 1007000 ==========
    PIC_ERROR(1007001, "图片异常"),
    PIC_NOT_FOUND(1007002, "图片未找到"),

    FILE_UPLOAD_ERROR(1007003, "上传文件失败!"),
    SSL_PARAM_ERROR(1007004, "SSL参数有误"),
    SYSTEM_CHECK_PARAM_ERROR(1007005, "系统自检参数有误"),
    SYSTEM_CHECK_ERROR(1007006, "系统自检异常"),

    // ========== 系统 1008000 ==========
    ENGINE_NOT_FOUND(1008001, "未找到引擎信息"),
    ENGINE_REMOVED(1008002, "引擎已移除");

    private final Integer code;
    private final String msg;

    BizError(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public Integer getCode() {
        return code;
    }
}